package com.gxa.controller;

import com.gxa.pojo.Mp;
import com.gxa.utils.Constants;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/26 17:51
 * Description:查询通过文章id来查
 * Version: V1.0
 */
@RestController
@Api(value = "推送信息",tags = "推送信息")
@RequestMapping(value = "options")
public class PushImforController {

    @Autowired
    private ResponseData responseData;
    @Autowired(required = false)
    private Constants constants;

    @PostMapping("/addPushImfor")
    @ApiOperation(value = "添加推送信息",notes = "根据提交的信息添加推送信息",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "添加成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "添加失败")
    })
    public ResponseData addPushImfor(@RequestBody @ApiParam(name = "mp",value = "推送信息",required = true) Mp mp){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("添加成功");
        responseData.setData(mp);
        return responseData;
    }



    @GetMapping("/delPushImfor")
    @ApiOperation(value = "删除推送信息",notes = "根据提交的信息删除推送信息",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "操作成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "操作失败")
    })
    public ResponseData delPushImfor(@ApiParam(name = "modStatu",value = "推送信息id",required = true) int mpId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("操作成功");
        responseData.setData(mpId);
        return responseData;
    }




    @GetMapping("/updatePushImfor")
    @ApiOperation(value = "修改推送信息",notes = "根据提交的信息修改推送信息",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "修改成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "修改失败")
    })
    public ResponseData updatePushImfor(@ApiParam(name = "mpId",value = "推送信息id",required = true) int mpId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("修改成功");
        responseData.setData(mpId);
        return responseData;
    }





    @PostMapping("/queryPushImfor")
    @ApiOperation(value = "查询推送信息",notes = "根据提交的信息查询推送信息",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryPushImfor(@ApiParam(name = "mp",value = "推送信息",required = true) Mp mp){
        mp.setMpStatus(1);
        mp.setMpPmc("内容");
        mp.setMpPms(1);
        mp.setArticleId(1);
        responseData.setMsg("查询成功");
        responseData.setData(mp);
        return responseData;
    }
}
